package com.herench.bs.handler;

import com.herench.bs.annotation.Handler;
import com.herench.bs.support.AbstractMessageHandler;
import com.herench.bs.support.RequestMessage;
import com.herench.bs.support.ResponseMessage;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

import java.util.HashMap;
import java.util.Map;

@Component
@Handler(code = "101110" ,name="检测更新")
public class CheckUpdateHandler extends AbstractMessageHandler {
    @Override
    protected ResponseMessage innerHandler(RequestMessage requestMessage) throws Exception {
        ResponseMessage responseMessage = new ResponseMessage(requestMessage.getId());
        String channelCode = requestMessage.getArgsPropertyStringValue("sysCode");
        Assert.notNull(channelCode, "sysCode 不能为空！");
        Map<String, Object> resMap = new HashMap<>();
        if (channelCode.equals("100101")) {
            resMap.put("no","版本号");
            resMap.put("url","https://www.zgosn.com/");
        }
        responseMessage.setData(resMap);
        responseMessage.setCode("0");
        responseMessage.setMessage("请求成功");
        return responseMessage;
    }
}
